home *** CD-ROM | disk | FTP | other *** search
- Path: keats.ugrad.cs.ubc.ca!not-for-mail
- From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
- Newsgroups: comp.lang.c
- Subject: Re: "Best fit" algorithm (help)
- Date: 1 Apr 1996 07:06:39 -0800
- Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
- Message-ID: <4jordvINNi5m@keats.ugrad.cs.ubc.ca>
- References: <APC&7'0'22b6b83'874@peg.apc.org> <4ji4b1$jc5@news1.mnsinc.com> <4jnq7t$643@airdmhor.gen.nz> <4jop2g$m9p@news1.mnsinc.com>
- NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
-
- In article <4jop2g$m9p@news1.mnsinc.com>,
- Szu-Wen Huang <huang@mnsinc.com> wrote:
- >Simon Hosie (gumboot@airdmhor.gen.nz) wrote:
- >
- >: Szu-Wen Huang:
- >: > The solution to the knapsack problem is to randomly allocate?! I'm
- >: > fairly sure my algorithm teacher doesn't know this yet. Care to show
- >: > some numbers? *Chuckle*
- >
- >: He said it was faster than brute force. I couldn't be bothered writing my
- >: own so I just accepted it. It's got me curious, now, I think I might have a
- >: go at it.
- >
- >The knapsack problem has a large search space, and is NP I think. That
- >generally means a random search won't get you very far.
-
- But the problem at hand is _not_ a knapsack problem! It is a cousin of the
- knapsack problem. In the real knapack problem, you have to find a subset of a
- given set of integers such that they sum _precisely_ to a given value.
-
- In this problem, the subset has to form a sum _less than or equal_ to a given
- value (the length of the tape). Thus many solutions are acceptable, with some
- being better than others. Some sort of acceptable threshold can be set for what
- is an acceptable amount of wasted space left on the tape. A random mixing could
- turn up solutions, especially when the set of songs is not that large.
-
- If you think about it, a human could solve this problem without mechanically
- seaching a large space in NP time. Many people successfully put together audio
- tapes without even knowing what an algorithm is! :)
-
- On a slow, 8-bit machine (such as the C-64), your computing power and amount of
- memory is limited (though, as I recall, that didn't prevent Sargon II running
- on an 8-bit machine from playing a mean game of chess!!!).
- --
-
-